package com.yc.register;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.jdbc.core.JdbcTemplate;

import javax.annotation.Resource;
import javax.sql.DataSource;

@Configuration
@ComponentScan("com.yc.register")
//检查环境参数myconfig.login=true开启该功能
@ConditionalOnProperty(
        prefix = "myconfig.reg",
        name = "enable",
        matchIfMissing = false
)
public class RegisterConfig {
    @Resource
    DataSource dataSource;

    JdbcTemplate jdbcTemplate(){
        return new JdbcTemplate(dataSource);
    }
}
